﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService
Partial Class FrontEnd_Control_Contents_ZoomImgDetail
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            If Page.RouteData.Values("Id") <> "" Then
                hidId.Value = Page.RouteData.Values("Id")
            Else
                If hidId.Value = "" Then
                    hidId.Value = 0
                End If
            End If
            BindMenu()
        End If
    End Sub
    Protected Sub BindMenu()
        Using data As New VSEntities
            'ParenId = 0 Menu cha
            'MenuPosition = 1 hien thi tren menu
            Dim d = (From p In data.Contents Where p.Id = hidId.Value Select p).FirstOrDefault
            If Not d Is Nothing Then
                'neu la video IsYoutube = true se hien thi video
                Dim IsYoutube = d.IsYoutube
                Dim _video = (From p In data.Contents Where ((p.Id = hidId.Value) And (p.IsYoutube Is Nothing)) Select p).FirstOrDefault
                If Not _video Is Nothing Then
                    'ltrVideo.Text = _video.URL
                    imgZoomDetail.ImageUrl = CookedImageURL("780-551", _video.Image)
                Else
                    'imgDetail.ImageUrl = CookedImageURL("600-450", d.Image)
                    'imgZoomDetail.Style.Add("Display", "none")
                End If
            End If


        End Using
    End Sub
End Class
